var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
    value: !0
});
var o = e("DataMgr"),
i = cc._decorator,
a = i.ccclass,
r = i.property,
s = function(e) {
    __extends(t, e);
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        t.panel = null;
        t.clickPanel = null;
        t.showGiftPanel = null;
        t.clickBtn = null;
        t.progressBar = null;
        t.timeLabel = null;
        t.normalShareNode = null;
        t.timeCount = 0;
        t.rewardNum = 0;
        t.rewardLabel = null;
        return t
    }
    n = t;
    t.prototype.onLoad = function() {
        n.Instance = this
    };
    t.prototype.freshTime = function() {
        this.timeLabel.string = "<b>连续点击 <color=#ff0000>" + this.timeCount + "</c> 次"
    };
    t.prototype.openPanel = function() {
        this.panel.active = !0;
        this.clickPanel.active = !0;
        this.showGiftPanel.active = !1;
        this.progressBar.progress = .5;
        this.clickBtn.active = !0;
        this.rewardNum = 0;
        this.timeCount = 0;
        this.freshTime();
        this.clickBtn.stopAllActions();
        var e = cc.scaleTo(.15, 1.1).easing(cc.easeSineInOut()),
        t = cc.scaleTo(.15, 1).easing(cc.easeSineInOut()),
        n = cc.delayTime(.2),
        o = cc.scaleTo(.15, 1.1).easing(cc.easeSineInOut()),
        i = cc.scaleTo(.15, 1).easing(cc.easeSineInOut()),
        a = cc.delayTime(1),
        r = cc.repeatForever(cc.sequence(e, t, n, o, i, a));
        this.clickBtn.runAction(r)
    };
    t.prototype.closePanel = function() {
        this.clickPanel.active = !1;
        this.showGiftPanel.active = !1;
        this.panel.active = !1
    };
    t.prototype.start = function() {};
    t.prototype.update = function(e) {
        var t = this;
        if (this.progressBar.progress > 0 && this.progressBar.progress < 1) {
            this.progressBar.progress -= .1 * e;
            this.progressBar.progress <= 0 && this.scheduleOnce(function() {
                t.closePanel()
            },
            .5)
        }
    };
    t.prototype.addProgressClick = function() {
        var e = this;
        this.timeCount++;
        this.freshTime();
        this.progressBar.progress += .04;
        if (this.progressBar.progress >= 1) {
            this.clickBtn.active = !1;
            this.rewardNum = 10 * this.timeCount;
            this.rewardLabel.string = "x" + this.rewardNum;
            this.scheduleOnce(function() {
                e.clickPanel.active = !1;
                e.showGiftPanel.active = !0
            },
            .5)
        }
    };
    t.prototype.getBtnClick = function() {
        o.default.Instance.coinNum += this.rewardNum;
        SDK.ToastMgr.Inst.showToast("恭喜获得 " + this.rewardNum + " 金币");
        this.closePanel()
    };
    var n;
    t.Instance = null;
    __decorate([r(cc.Node)], t.prototype, "panel", void 0);
    __decorate([r(cc.Node)], t.prototype, "clickPanel", void 0);
    __decorate([r(cc.Node)], t.prototype, "showGiftPanel", void 0);
    __decorate([r(cc.Node)], t.prototype, "clickBtn", void 0);
    __decorate([r(cc.ProgressBar)], t.prototype, "progressBar", void 0);
    __decorate([r(cc.RichText)], t.prototype, "timeLabel", void 0);
    __decorate([r(cc.Node)], t.prototype, "normalShareNode", void 0);
    __decorate([r(cc.Label)], t.prototype, "rewardLabel", void 0);
    return n = __decorate([a], t)
} (cc.Component);
n.default = s